Skip to content

Fix NativeAOT custom release configurations - #12451

Open
jonathanpeppers wants to merge 3 commits into
mainfrom
jonathanpeppers-test-appstore-nativeaot
Open

Fix NativeAOT custom release configurations#12451
jonathanpeppers wants to merge 3 commits into
mainfrom
jonathanpeppers-test-appstore-nativeaot

Conversation

@jonathanpeppers

@jonathanpeppers jonathanpeppers commented Aug 19, 2026

Copy link
Copy Markdown
Member

NativeAOT runtime-pack libraries only have debug and release flavors, but the Android targets derived their names from $(Configuration). Custom release-like configurations such as AppStore therefore tried to resolve nonexistent runtime libraries.

This change:

  • selects the NativeAOT runtime for publish or optimized builds with PublishAot=true
  • keeps ordinary unoptimized Debug builds on CoreCLR while retaining NativeAOT analyzers and preventing ILC publish targets from running during build
  • selects the runtime-pack library flavor from $(Optimize) instead of the configuration name
  • makes NativeAOT solution tests explicitly build their Release configurations
  • adds build and publish device coverage for a release-like AppStore configuration, including install and launch verification

Fixes: #10851

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e48442c2-2acb-4228-9eec-4b7930738a0f
Copilot AI lite review requested due to automatic review settings August 19, 2026 17:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new MSBuildDeviceIntegration device regression test intended to cover NativeAOT builds/publishes using a custom “release-like” configuration name (AppStore) and validate the produced APK can be installed and launched on-device, matching the scenario from #10851.

Changes:

  • Adds NativeAOTCustomReleaseConfiguration device test parameterized over dotnet build vs dotnet publish.
  • Uses a custom release configuration name (AppStore) while setting Release-like MSBuild properties (Optimize=true, DebugType=None).
  • Installs the produced signed APK via adb and asserts the activity launches.
Suppressed comments (1)

tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs:2786

  • adb install output commonly includes additional lines (e.g., "Performing Streamed Install") before "Success". Using Assert.AreEqual("Success", ...) can make the test fail even when install succeeded; assert that the output contains "Success" instead.
			Assert.AreEqual ("Success", RunAdbCommand ($"install -r \"{apk}\"").Trim (), "APK should install.");

Comment thread tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs
Select NativeAOT for publish or optimized builds while keeping unoptimized Debug builds on CoreCLR. Resolve NativeAOT runtime-pack libraries by optimization flavor instead of the project configuration name.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e48442c2-2acb-4228-9eec-4b7930738a0f
@jonathanpeppers jonathanpeppers changed the title Add failing NativeAOT custom configuration device test Fix NativeAOT custom release configurations Aug 21, 2026
Disable the ILC publish-target import when PublishAot is used with a non-NativeAOT runtime, while preserving analyzer behavior. Ensure solution tests requesting NativeAOT actually build their Release configurations.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e48442c2-2acb-4228-9eec-4b7930738a0f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NativeAOT] Build fails when configuration is not 'Release' or Debug

2 participants